The previous logic was copied from 12_network-generate-ula, but fails to
account for upgrades where the "auto" value isn't set (it is set by
base-files/files/bin/config_generate). Fix this to always set the
default duid if it isn't set.
Also, rename the file to better reflect what it does.
Closes: #21029
Fixes: a660a076db5a ("base-files: generate a global DHCP DUID")
Link: https://github.com/openwrt/openwrt/pull/21118
Signed-off-by: David Härdeman <[email protected]>
Signed-off-by: Petr Štetiar <[email protected]> [fixes,closes tag]
+++ /dev/null
-[ "$(uci -q get network.globals.dhcp_default_duid)" != "auto" ] && exit 0
-
-uci -q batch <<-EOF >/dev/null
- # DUID-UUID - RFC6355
- set network.globals.dhcp_default_duid="$(printf '%s%s' '0004' $(cat /proc/sys/kernel/random/uuid | sed -e 's/-//g'))"
- commit network
-EOF
-
-exit 0
--- /dev/null
+[ "$(uci -q get network.globals.dhcp_default_duid || echo "auto")" != "auto" ] && exit 0
+
+uci -q batch <<-EOF >/dev/null
+ # DUID-UUID - RFC6355
+ set network.globals.dhcp_default_duid="$(printf '%s%s' '0004' $(cat /proc/sys/kernel/random/uuid | sed -e 's/-//g'))"
+ commit network
+EOF
+
+exit 0